#pragma once
/*from nettle*/
#include "typedef.h"

#define SHA256_DIGEST_SIZE   32
#define SHA256_BLOCK_SIZE    64
#define SHA256_DIGEST_LENGTH 8

typedef struct sha256_ctx sha256_ctx_t;

struct sha256_ctx {
    uint32_t     state[SHA256_DIGEST_LENGTH]; /* State variables */
    uint64_t     count;                       /* 64-bit block count */
    unsigned int index;                       /* index into buffer */
    uint8_t      block[SHA256_BLOCK_SIZE];
};

void sha256_init(struct sha256_ctx* ctx);
void sha256_update(struct sha256_ctx* ctx, const uint8_t* data, size_t len);
void sha256_final(struct sha256_ctx* ctx, uint8_t* out, size_t outlen);
void sha256(const uint8_t* data, size_t len, uint8_t* out, size_t outlen);